<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Admin
 * Date: 17.06.11
 * Time: 23:09
 * To change this template use File | Settings | File Templates.
 */

include_once 'config.php';
$dir = opendir($config['OUT']);
$outputFile = fopen($config['OUT'].'/categories.txt', 'w');
while($fileName = readdir($dir)){
    if($fileName == '.' || $fileName == '..' || $fileName == 'log.txt')continue;
    $str = file_get_contents($config['OUT'].'/'.$fileName);
    preg_match('@(<div class="breadcrumbs">([^<]*)<\/div>)@', $str, $matches);
    $categories[] = $matches[2];
}
$categories = array_unique($categories);
foreach($categories as $category){
    fwrite($outputFile, '<div>'.$category.'</div>|');
}
fclose($outputFile);
fclose($dir);

?>
 
